//
// Created by denglibin on 2020/7/1.
//
#include <stdio.h>
int mySqrt(int x){
    if(x == 1){
        return 1;
    }
    int max = x;
    int min = 0;
    unsigned long long  mid = (max + min) / 2;
    while (min < mid){
        if(mid * mid == x){
            return (int)mid;
        }
        if (mid * mid < x){
            min = (int)mid;
            mid = (min + max)/2;
        }else {
            max = (int)mid;
            mid = (min + max)/2;
        }
    }
    return (int)mid;
}

static int main3(){
    int x = mySqrt(1);
    printf("%d\n", x);
    return 0;
}